﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RosarioFinanzas
{
    public partial class Formulario_web14 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            if (txtApellido.Text.Length > 0 && txtMail.Text.Length > 0 && txtComentario.Text.Length > 0)
            {
                var correo = new System.Net.Mail.MailMessage
                {
                    From = new System.Net.Mail.MailAddress("info@rosariofinanzas.com.ar")
                };
                correo.To.Add("info@rosariofinanzas.com.ar");
                correo.Subject = "Contacto";
                correo.Body = "Contacto" + ":" + txtApellido.Text + ", " + txtNombre.Text + "\r\n" + "\r\n";
                correo.Body = correo.Body + "Mail" + ":" + this.txtMail.Text + "\r\n";
                correo.Body = correo.Body + "Telefono" + ":" + this.Telefono.Text + "\r\n";
                correo.Body = correo.Body + "Descripción" + ":" + this.txtComentario.Text;
                correo.IsBodyHtml = false;
                correo.Priority = System.Net.Mail.MailPriority.Normal;
                var smtp = new System.Net.Mail.SmtpClient
                {
                    Host = "mail.rosariofinanzas.com.ar",
                    Credentials =
                        new System.Net.NetworkCredential("info@rosariofinanzas.com.ar", "Info123456")
                };
                smtp.Send(correo);
                this.RegisterStartupScript("Cartel","<script>alert('Su consulta ha sido enviada... en breve nos comunicaremos. ')</script>");
                
            }
        }
        [WebMethod]
        public static string strFecha(string str)
        {

            string[] dayarray = { "Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado" };
            string[] montharray = { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" };
            var daym = DateTime.Today.Day.ToString();
            var year = DateTime.Today.Year.ToString();
            var day = Convert.ToInt32(DateTime.Today.DayOfWeek);
            var month = DateTime.Today.Month - 1;
            return dayarray[day] + ", " + daym + " de " + montharray[month] + " del " + year + " ";

        }
    }
}
